home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / F / File Readers / Blind_Freddy.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-09-28  |  2.6 KB  |  113 lines  |  [TEXT/TPAS]

  1. PROGRAM Blind_Freddy;
  2. {$T APPLPUTE} { Set application ID }
  3. {$B+}
  4. {$R Blind_Freddy.rscs}
  5. {$U-}
  6.  
  7.   USES pasinout, memtypes, quickdraw, osintf, toolintf, packintf,
  8.     speechintf;
  9.  
  10.   TYPE
  11.     bytes = PACKED ARRAY [1..256] OF char;
  12.     byteptr = ^bytes;
  13.  
  14.   VAR
  15.     thefile: appfile;
  16.     myfinfo: finfo;
  17.     myoserr: oserr;
  18.     myrefnum: integer;
  19.     mycount, mymessage, x, y: integer;
  20.     speaking, readme: boolean;
  21.     dummy: longint;
  22.     mypoint: point;
  23.     mytypelist: sftypelist;
  24.     f: text;
  25.     tempstr: str255;
  26.     ch: char;
  27.     myreply: sfreply;
  28.  
  29.   PROCEDURE speakme(speakstr: str255);
  30.  
  31.     VAR
  32.       i, len: integer;
  33.       linein: str255; {the English text to be spoken}
  34.       lineptr: byteptr; {a pointer to the text}
  35.       output: handle; {Handle to phonetic string}
  36.       thespeech: speechhandle; {Handle to speech globals}
  37.  
  38.     BEGIN
  39.       IF speaking THEN
  40.         BEGIN
  41.           i := speechon('', thespeech);
  42.           IF (i <> 0) THEN
  43.             BEGIN
  44.               speaking := false;
  45.               sysbeep(20);
  46.               sysbeep(20);
  47.               sysbeep(20);
  48.             END;
  49.           IF (i <> 0) THEN exit;
  50.           linein := speakstr + '##';
  51.           linein[0]:=',';
  52.           lineptr := @linein;
  53.           output := newhandle(0);
  54.           hlock(output);
  55.           i := reader(thespeech, pointer(lineptr), 256, output);
  56.           i := macintalk(thespeech, output);
  57.           speechoff(thespeech);
  58.           hunlock(output);
  59.           disposhandle(output);
  60.         END;
  61.     END;
  62.  
  63.   PROCEDURE displayfile;
  64.  
  65.     BEGIN
  66.       WHILE NOT eoln(f) and not button DO
  67.         BEGIN
  68.           read(f, ch);
  69.           tempstr := tempstr + ch;
  70.           systemtask;
  71.         END;
  72.       readln(f);
  73.       speakme(tempstr);
  74.       tempstr := ' ';
  75.     END;
  76.  
  77.   BEGIN
  78.     readme := true;
  79.     speaking := true;
  80.     systemtask;
  81.     countappfiles(mymessage, mycount);
  82.     getappfiles(mycount, thefile);
  83.     myoserr := getfinfo(thefile.fname, thefile.vrefnum, myfinfo);
  84.     IF mycount = 0 THEN
  85.       BEGIN
  86.         sysbeep(20);
  87.         sysbeep(20);
  88.         sysbeep(20);
  89.         readme := false;
  90.       END
  91.     ELSE
  92.       BEGIN
  93.         systemtask;
  94.         systemtask;
  95.       END;
  96.     IF readme AND ((myfinfo.fdtype = 'TEXT') OR (myfinfo.fdtype =
  97.        'ttro')) THEN
  98.       BEGIN
  99.         tempstr := ' ';
  100.         myoserr := setvol(NIL, thefile.vrefnum);
  101.         speakme('Hold down the mouse button to Quit');
  102.         speakme('Hello, This is a file called ' + thefile.fname);
  103.         reset(f, thefile.fname);
  104.         REPEAT
  105.           systemtask;
  106.           displayfile;
  107.           systemtask;
  108.         UNTIL (eof(f) OR button);
  109.         close(f);
  110.       END;
  111.     clrappfiles(mycount);
  112.   END.
  113.